package org.tuio4j.profile.obj2d;

import org.tuio4j.TuioEvent;

//TODO: Complete and test
/**
 * See license.txt for license information.
 * @author Uwe Laufs
 * @version 1.0
 */
public class Tuio2DObjectEvent extends TuioEvent {
	private int sessionId; // tuio spec:s
	private int markerId; // tuio spec:i
	private float xRel; // tuio spec:x
	private float yRel; // tuio spec:y
	private float angleRadians; // tuio spec:a
	private float xVelocity; // tuio spec:X
	private float yVelocity; // tuio spec:Y
	private float rotationVelocityVector; // tuio spec:A
	private float motionAcceleration; // tuio spec:m
	private float rotationAcceleration; // tuio spec:r
	
	public Tuio2DObjectEvent(
							int eventTypeId, // TuioEvent.THE_CORRECT_EVENT_TYPE, 
							int sessionId, // tuio spec:s
							int markerId, // tuio spec:i
							float xRel, // tuio spec:x
							float yRel, // tuio spec:y
							float angleRadians, // tuio spec:a
							float xVelocity, // tuio spec:X
							float yVelocity, // tuio spec:Y
							float rotationVelocityVector, // tuio spec:A
							float motionAcceleration, // tuio spec:m
							float rotationAcceleration // tuio spec:r
	){
		super(eventTypeId);
		this.sessionId = sessionId;
		this.markerId = markerId;
		this.xRel = xRel;
		this.yRel = yRel;
		this.angleRadians = angleRadians;
		this.xVelocity = xVelocity;
		this.yVelocity = yVelocity;
		this.rotationVelocityVector = rotationVelocityVector;
		this.motionAcceleration = motionAcceleration;
		this.rotationAcceleration = rotationAcceleration;
	}
	
	public int getSessionId() {
		return sessionId;
	}
	public int getMarkerId() {
		return markerId;
	}
	public float getXRel() {
		return xRel;
	}
	public float getYRel() {
		return yRel;
	}
	public float getAngleRadians() {
		return angleRadians;
	}
	public float getXVelocity() {
		return xVelocity;
	}
	public float getYVelocity() {
		return yVelocity;
	}
	public float getRotationVelocityVector() {
		return rotationVelocityVector;
	}
	public float getMotionAcceleration() {
		return motionAcceleration;
	}
	public float getRotationAcceleration() {
		return rotationAcceleration;
	}

	public String toString(){
		String typeString="NO TYPE";
		if(this.getEventTypeId()==TuioEvent.SESSION_DETECTED){
			typeString = "SESSION_DETECTED";
		}else if(this.getEventTypeId()==TuioEvent.SESSION_UPDATED){
			typeString = "SESSION_UPDATED";
		}else if(this.getEventTypeId()==TuioEvent.SESSION_ENDED){
			typeString = "SESSION_ENDED";
		}
		return typeString +
				" sid:" + this.getSessionId() +
				" mid:" + this.getSessionId() +
				" x:" + this.getXRel() +
				" y:" + this.getYRel() +
				" aRad:" + this.angleRadians +
				" xVel:" + this.getXVelocity() +
				" yVel:" + this.getYVelocity() +
				" rVV:"  + this.getRotationVelocityVector() +
				" m Acl:" + this.getMotionAcceleration() +
				" rAcl:" + this.getRotationAcceleration();
	}
}
